<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      p {
        height: 300px;
        border: solid;
      }
    </style>
  </head>
  <body>
    <p>hello p1</p>
    <p>hello p2</p>
    <p>hello p3</p>
    <p>hello p4</p>
    <p>hello p5</p>
    <p>hello p6</p>
    <p>hello p7</p>
    <p>hello p8</p>
    <p>hello p9</p>
    <script>
      console.log("外宽", window.innerWidth);
      console.log("外高", window.innerHeight);

      console.log("内容高度", document.documentElement.scrollHeight);
      console.log("内容宽度", document.documentElement.scrollWidth);

      setTimeout(() => {
        console.log("滚出高度", window.pageYOffset);
        console.log("滚出宽度", window.pageXOffset);

        console.log(
          document.documentElement.scrollHeight -
            window.pageYOffset -
            window.innerHeight
        );
      }, 3000);
    </script>
  </body>
</html>
